/*
 *  common.h
 *  test
 *
 *  Created by Holmes Futrell on 9/4/08.
 *  Copyright 2008 Holmes Futrell. All rights reserved.
 *
 */

#import <math.h>
#include <stdlib.h>
#include <stdio.h>
#include "math.h"

#ifndef __COMMON_H
#define __COMMON_H

#ifndef pi
#define pi 3.14159265f
#endif

int powerOfTwo(int p);
void swapf(float *x1, float *x2);
float clampf(float x, float min, float max);
float signf(float x);
int clampi(int x, int min, int max);

static inline int maxi(int x, int y) { return x > y ? x : y; }
static inline int mini(int x, int y) { return x > y ? y : x; }
static inline float maxf(float x, float y) { return x > y ? x : y; }
static inline float minf(float x, float y) { return x > y ? y : x; }

float randomFloat(float min, float max);
int randomInt(int min, int max);
float toDegrees(float angle);

#endif